package com.dudsbury.jtablestuff;
import java.awt.Component;
import java.awt.Color;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

import com.dudsbury.database.Booking;
public class CustomTableCellRenderer extends DefaultTableCellRenderer 
{
    public Component getTableCellRendererComponent
       (JTable table, Object booking, boolean isSelected,
       boolean hasFocus, int row, int column) 
    {
        Component cell = super.getTableCellRendererComponent
           (table, booking, isSelected, hasFocus, row, column);
       
            //Integer amount = (Integer) value;
            if( booking!=null)
            {
            	
                cell.setBackground( Color.RED );
                // You can also customize the Font and Foreground this way
                // cell.setForeground();
                // cell.setFont();
            }
            else
            {
            	System.out.println("Setting Green");
                cell.setBackground( Color.GREEN );
            }
        
        return cell;
    }
}
